// 配置文件，之后的中间件需要在config/index.js中进行配置
const router = require("../router/index")
const koaBody = require("koa-body")
const static = require('koa-static')
const render = require('koa-art-template');
const path = require("path")
function initProject(app){
    app.use(koaBody())
    app.use(router.routes())
    // path.join()  可以拼接字符串
    var res = path.join(process.cwd(),'static')
    app.use(static(res))
    render(app, {
        root: path.join(process.cwd(), 'pages'),//文件路径
        extname: '.html',//文件后缀名
        debug: process.env.NODE_ENV !== 'production'
    });
}
module.exports = initProject
